
#ifndef _MEMBER_BTHREAD_H_
#define _MEMBER_BTHREAD_H_

#include <ctime>
#include <BThread>

#ifdef linux
#include <pthread.h>
#include <unistd.h>
#include <sys/time.h>
#endif

#ifdef _WIN32
#include <Windows.h>
#endif

#define thread_member(thread)		((member_BThread*)((BThread*)thread)->_ptr)

namespace BWE
{
	class member_BThread
	{
	public:
		member_BThread(BThread* thread);
		~member_BThread();

		int run();

		BThread*	boss;
		bool		runing;
		bool		done;
		int			code;
		int			frequency;
		int			realFrequency;
		int			frameCount;
		BReal		frameTick;
		
#ifdef linux
		pthread_t		thread_id;
		pthread_cond_t 	cond;
		pthread_mutex_t	mutex;
#endif
		
#ifdef _WIN32
		DWORD		thread_id;
		HANDLE		handle;
		HANDLE		htimer;
#endif
	};
}
#endif

